﻿using NSwag.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Video.Application.Contract.Base
{
    public class PageRequestDto
    {
        private int _page = 1;
        private int _pageSize = 20;
        public int Page
        {
            get => _page;
            //如果传入的值小于或等于0，value等于1
            set => _page = value<=0 ? 1 : value;
        }
        public int PageSize
        {
            get => _pageSize;
            set =>_pageSize=value <= 0 ? 20 : value;
        }
        /// <summary>
        /// 忽略，只传Page和PageSize
        /// </summary>
        [OpenApiIgnore]
        public new int SkipCount => (Page - 1) * MaxResultCount;
        [OpenApiIgnore]
        public new int MaxResultCount => PageSize > 1000 ? 1000 : PageSize;
    }
}
